//文章
import request from '../utils/request';
import qs from 'qs';
const baseUrl = 'https://riverxin.cn/xinxin-article-image';
// const baseUrl = 'http://localhost:3004/xinxin-article-image';
const url = {
    list: `${baseUrl}/home-list`,
    detail: `${baseUrl}/detail`,
    downLoadUrl: `${baseUrl}/download/static`,
    downLoadCompress: `${baseUrl}/download/compress`
};

const homeList = (data = {}) =>
    request.get(url.list, {
        params: data
    });

const detail = (id = '', isReplace = false) =>
    request.get(url.detail, {
        params: {
            id,
            isReplace
        }
    });
const downLoadStatic = (downLoadUrl = '') =>
    request.post(url.downLoadUrl, {
        url: downLoadUrl
    });

const downLoadCompress = pageTotal =>
    url.downLoadCompress +
    qs.stringify({ pageTotal }, { addQueryPrefix: true });

export { homeList, detail, downLoadStatic, downLoadCompress };
